<div id="logo">
    <h1>Por categoria:</h1>
</div>
<div id="menu">
    <ul>
        <li><a a href="?c=Publicacao&a=listC&p=0">Todas</a></li>
        <?php
        foreach ($cat as $categoria):
            ?>
            <li><a a href="?c=Publicacao&a=listC&p=<?php echo $categoria['Categoria']['id']; ?>"><?php echo $categoria['Categoria']['name']; ?></a></li>
            <?php
        endforeach;
        ?>
    </ul>
</div>
<div class="clear"></div>
<table cellpadding="0" cellspacing="0">
    <thead>
        <tr>
            <th>
                Nome
            </th>
            <th>
                Assunto
            </th>
            <th>
                Categoria
            </th>
            <th>
                Edição
            </th>
            <th>
                Orientador
            </th>
            <th>
                Autor
            </th>
            <th>
                Data
            </th>
            <th>
                Editar
            </th>
            <th>
                Deletar
            </th>
            <th>
                Arquivo
            </th>
        </tr>
    </thead>
    <tbody>
        <?php
        $i = 0;
        foreach ($result as $publicacao):
            $i++
            ?>
            <tr <?php echo ($i % 2 == 0) ? 'class="gray"' : "" ?>>
                <td><?php echo $publicacao['Publicacao']['nome'] ?></td>
                <td><?php echo $publicacao['Publicacao']['assunto'] ?></td>
                <td><?php echo $publicacao['Categoria']['name'] ?></td>
                <td><?php echo $publicacao['Publicacao']['edicao'] ?></td>
                <td><?php echo $publicacao['Publicacao']['orientador'] ?></td>
                <td><?php echo $publicacao['Autor']['name'] ?></td>
                <td><?php echo date('d M y', strtotime($publicacao['Publicacao']['datapublicacao'])) ?></td>
                <td><a a href="?c=Publicacao&a=edit&p=<?php echo $publicacao['Publicacao']['id'] ?>">Editar</a></td>
                <td><a a href="?c=Publicacao&a=delete&p=<?php echo $publicacao['Publicacao']['id'] ?>">Deletar</a></td>
                <td><a href="File/<?php echo $publicacao['Publicacao']['file'] ?>">Baixar</a></td>
            </tr>
            <?php
        endforeach;
        ?>
    </tbody>
</table>